<template>
    <el-tag :type="type">{{ gameData.id }} ) {{ gameData.name }}</el-tag>
</template>

<script>
    export default {
        props: {
            id: {
                type: [String, Number]
            },
            type: {
                type: String,
                default: 'info',
            },
        },
        data () {
            return {};
        },
        watch: {},
        computed: {
            scenes () {
                return this.$store.state.scene.all;
            },
            gameData() {
                let data = {
                    id: this.id || '-',
                    name: this.name || '-',
                };
                for (let i in this.scenes) {
                    if (this.scenes[i].id === this.id) {
                        data = this.scenes[i];
                        break;
                    }
                }
                return data;
            },
        },
        methods: {
            getScenes() {
                if (!this.scenes.length) this.$store.dispatch('scene/All', 'scene');
            },
        },
        created() {
            this.getScenes();
        }
    }
</script>

<style scoped>

</style>
